﻿Public Class ctrlCuaHang
    Private _CuaHang As tbCuaHang
    Property CuaHang As tbCuaHang
        Get
            Return _CuaHang
        End Get
        Set(value As tbCuaHang)
            If value Is Nothing Then Exit Property
            _CuaHang = value
            bsCuaHang.DataSource = CuaHang
        End Set
    End Property

    Private Sub pctLogo_Click(sender As Object, e As EventArgs) Handles pctLogo.Click
        btnChonHinhAnh_Click(Nothing, Nothing)
    End Sub

    Private Sub btnChonHinhAnh_Click(sender As Object, e As EventArgs) Handles btnChonHinhAnh.Click
        Dim openFile As New OpenFileDialog
        openFile.Filter = "Image Files (*.png, *.jpg)|*.png;*.jpg"
        If (openFile.ShowDialog) = DialogResult.OK Then
            txtDuongDan.Text = openFile.FileName
        End If
        Try
            pctLogo.Image = Image.FromFile(txtDuongDan.Text)
            txtDuongDan.Text = txtDuongDan.Text
        Catch
            ComponentFactory.Krypton.Toolkit.KryptonMessageBox.Show("Không lấy được ảnh", "Thông báo", MessageBoxButtons.OK)
        End Try
    End Sub
End Class
